#include <iostream>
using namespace std;

class A
{
public:
    virtual void f(){ cout << "A::f()" << endl;}
};
class B : public A
{
private:
    virtual void f(){cout << "B::f()" << endl;}
};
void Test1()
{
    A* pa = (A*)new B;
    pa->f();
}


class A1
{
public:

  A1() :m_iVal(0) { t(); }
  virtual void func() { std::cout << m_iVal << " "; }
  void t() { func(); }
public:
  int m_iVal;
};
class B1 : public A1
{
public:
    B1() { t(); }
    virtual void func()
    {
        ++m_iVal;
    std::cout << m_iVal << " ";
    }

};
void Test2()
{
    A1* p = new B1;
    p->t();
}


int main()
{
   // Test1();
    
    Test2();
    return 0;
}